<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../lib/vue.js"></script>
</head>
<body>
    <!-- .lazy 失去焦点同步一次 -->
    <!-- .number 格式化数字 -->
    <!-- .trim 去除首位空格 -->

    <div id="box">
        <!-- 使得不会实时更新，失去焦点才行 -->
        用户名：<input type="text" v-model.lazy="myText"> {{myText}}
        <button @click="handleSubmit"></button>
    </div>

    <script>
        var vm = new Vue({
            el:"#box",
            data: {
                myText: "",
            },
            methods: {
                handleSubmit() {
                    console.log(this.myText)
                }
            }
        })
    </script>
</body>
</html>